﻿<UserControl x:Class="SimpleMvvmCommands.CalcView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:s="clr-namespace:System;assembly=mscorlib"
    xmlns:my="clr-namespace:SimpleMvvmCommands"
    mc:Ignorable="d"
    d:DesignHeight="200" d:DesignWidth="300"
    >
    <UserControl.Resources>
        <my:CalcViewModel x:Key="vm" />
    </UserControl.Resources>
    
    <Grid x:Name="LayoutRoot" Background="White" Height="200" Width="300"
          DataContext="{StaticResource vm}">
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <TextBlock Grid.Column="0" Text="Amount:" VerticalAlignment="Center"/>
        <TextBox Grid.Column="1" Height="30" Text="{Binding Path=Amount, Mode=TwoWay}"/>
        <TextBlock Grid.Row="1" Grid.Column="0" Text="Total:" VerticalAlignment="Center"/>
        <TextBox Grid.Row="1" Grid.Column="1" Height="30" Text="{Binding Path=Total, Mode=TwoWay}"/>
        <Button Content="Add 1" Grid.Row="2" Height="30" Width="60"
                Command="{Binding AddCommand}"
                CommandParameter="1"/>
        <Button Content="Add 2" Grid.Row="2" Grid.Column="3" Height="30" Width="60" 
                Command="{Binding AddCommand}"
                CommandParameter="2"/> 
    </Grid>
</UserControl>
